package com.lizheng.yunservice.travel.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.lizheng.yunservice.travel.mapper.VtpNoticeMapper;
import com.lizheng.yunservice.travel.doamin.VtpNotice;
import com.lizheng.yunservice.travel.service.IVtpNoticeService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author 47967
 */
@Service
@Slf4j
@AllArgsConstructor
public class VtpNoticeServiceImpl implements IVtpNoticeService {

	private final VtpNoticeMapper vtpNoticeMapper;

	@Override
	public List<String> getHomeNotices() {
		LambdaQueryWrapper<VtpNotice> lambdaQueryWrapper = new LambdaQueryWrapper<>();
		lambdaQueryWrapper.select(VtpNotice::getNoticeContent);
		List<String> noticeList = vtpNoticeMapper.selectObjs(lambdaQueryWrapper)
				.stream()
				// 指定要转换的类型
				.map(o -> (String) o)
				.collect(Collectors.toList());
		return noticeList;
	}
}
